function fig = PlotResultsEP( output, subjectNrs, electrode, period)
%PlotResultsSEP Plot results per subject, electrode and period
% Normalize and merge blocks, display all 4 peaks.
%     subjectNr: int[] of all subjects to be included in run.
%     electrode: string
%     period: int

disp(['Period ' num2str(period) ' - Electrode ' electrode]);

[D X] = ResultsEP(output, subjectNrs, electrode, period);

fig = figure;
PlotElectrodePeriod(D, X, period, electrode);
end


function PlotElectrodePeriod(D, X, period, electrode)
subplot(4,2,1);
hold on
plot(X, D(1,:));
ylabel N1
title (['Period ' num2str(period) ' - Electrode ' electrode]);

subplot(4,2,2);
hold on
plot(X, D(2,:));

subplot(4,2,3);
hold on
plot(X, D(3,:));
ylabel P1

subplot(4,2,4);
hold on
plot(X, D(4,:));

subplot(4,2,5);
hold on
plot(X, D(5,:));
ylabel N2

subplot(4,2,6);
hold on
plot(X, D(6,:));

subplot(4,2,7);
hold on
plot(X, D(7,:));
ylabel P2
xlabel 'latency'

subplot(4,2,8);
hold on
plot(X, D(8,:));
xlabel 'value'
end
